@extends('admin.layout')
@section('title','新增专家页')
@section('content')
    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
        <div class="col-md-12" id="content">

            <div class="app_content_div" id="app_content_div_301Index">
                <h3>新增专家</h3>
            </div>
            <form class="form-horizontal">
                @csrf
                <div class="form-group">
                    <label for="name" class="col-sm-2 control-label"><span style="color:red;">*</span>姓名</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="name" name="name">
                    </div>
                </div>
                <div class="form-group">
                    <label for="upload_file" class="col-sm-2 control-label"><span style="color:red;">*</span>头像</label>
                    <div class="col-sm-10">
                        <input type="file" name="thumb" class="form-control">
                </div>
                </div>


                <div class="form-group">
                    <label for="department" class="col-sm-2 control-label"><span style="color:red;">*</span>科室</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="keshi" name="keshi">
                    </div>
                </div>
                <div class="form-group">
                    <label for="title" class="col-sm-2 control-label"><span style="color:red;">*</span>职称</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="zhicheng" name="zhicheng" >
                    </div>
                </div>
                <div class="form-group">
                    <label for="postion" class="col-sm-2 control-label"><span style="color:red;">*</span>职务</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="zhiwu" name="zhiwu" >
                    </div>
                </div>
                <div class="form-group">
                    <label for="hospital" class="col-sm-2 control-label"><span style="color:red;">*</span>医院</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="yiyuan" name="yiyuan" >
                    </div>
                </div>
                <div class="form-group">
                    <label for="description" class="col-sm-2 control-label"><span style="color:red;">*</span>简介</label>
                    <div class="col-sm-10">
                        <div class="form-group">
                            <textarea id="jianli" class="form-control" rows="5"></textarea>

                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label for="hospital" class="col-sm-2 control-label"><span style="color:red;">*</span>接受教育</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="jieshoujiaoyu" name="jieshoujiaoyu" >
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="button" onclick="add()" class="btn btn-default">确定</button>
                    </div>
                </div>
            </form>




        </div>
    </div>
    <script>
        function add() {
            var name = $('#name').val();
            var keshi = $('#keshi').val();
            var zhicheng = $('#zhicheng').val();
            var zhiwu = $('#zhiwu').val();
            var yiyuan = $('#yiyuan').val();
            var jianli = $('#jianli').val();
            var jieshoujiaoyu = $('#jieshoujiaoyu').val();
            var _token = "{{csrf_token()}}";
            $.ajax({
                url: '/adm/expert/add',
                type: 'post',
                fileElementId:'src',
                dataType: 'json',
                data: {
                    'name': name, 'keshi': keshi,
                    'zhicheng': zhicheng, 'yiyuan': yiyuan,
                    'jianli': jianli, 'zhiwu': zhiwu, 'jieshoujiaoyu': jieshoujiaoyu,
                    '_token': _token
                },
            //     $.post('/adm/expertlist',
            //         {'name':name,'keshi':keshi,
            //         'zhicheng':zhicheng,
            //         'zhiwu':zhiwu,"yiyuan":yiyuan,'jianli':jianli,
            //         "jieshoujiaoyu":jieshoujiaoyu,'_token':_token },
                success:function (data) {
                if (data.success) {
                    alert(data.success);
                    location.href = '/adm/expertlist';
                } else {
                    alert(data.msg);
                }
            }


        });
        }
    </script>



@endsection
